import request from '@/utils/request' //request是instance的别名，instance就是自己封装好的axios进行数据交互的

//注册
export const userRegisterService = ({ username, password, repassword }) =>
  request.post('/api/reg', { username, password, repassword })

//登录
export const userLoginService = ({ username, password }) =>
  request.post('/api/login', { username, password })

//获取个人信息
export const userGetInfoService = () => request.get('/my/userinfo')

//更新个人信息
export const userUpdateInfoService = ({ id, nickname, email }) =>
  request.put('/my/userinfo', { id, nickname, email })

//跟新用户头像
export const userUpdateAvatarService = (avatar) =>
  request.patch('/my/update/avatar', { avatar })

//更新用户密码
export const userUpdatePwdService = ({ old_pwd, new_pwd, re_pwd }) =>
  request.patch('/my/updatepwd', { old_pwd, new_pwd, re_pwd })
